home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / VISCAFE.BIN / Position.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-06-19  |  1.8 KB  |  94 lines

  1. package symantec.itools.db.awt;
  2.  
  3. import symantec.itools.db.pro.RelationView;
  4. import symjava.sql.SQLException;
  5.  
  6. class Position {
  7.    int frozenRecordNumber;
  8.    int notificationMode;
  9.    boolean frozen = false;
  10.    RelationView relView;
  11.    int ignoreCount;
  12.    String name = "";
  13.  
  14.    Position(RelationView var1) {
  15.       this.relView = var1;
  16.  
  17.       try {
  18.          this.name = var1.getName();
  19.       } catch (SQLException var2) {
  20.       }
  21.    }
  22.  
  23.    void freeze() throws SQLException {
  24.       this.frozen = true;
  25.       this.ignoreNotification(true);
  26.       this.frozenRecordNumber = this.relView.getCurrentRecordNumber();
  27.       this.relView.enableBindingNotify(false, true);
  28.       this.relView.enableDetailSQL(false);
  29.    }
  30.  
  31.    void thaw() throws SQLException {
  32.       if (this.frozenRecordNumber > 0) {
  33.          this.goTo(this.frozenRecordNumber);
  34.       }
  35.  
  36.       this.relView.enableDetailSQL(true);
  37.       this.relView.enableBindingNotify(true, true);
  38.       this.frozen = false;
  39.       this.ignoreNotification(false);
  40.    }
  41.  
  42.    boolean set(int var1) throws SQLException {
  43.       if (this.relView.getCurrentRecordNumber() == var1) {
  44.          return true;
  45.       } else {
  46.          if (this.getNotificationMode() && !this.frozen) {
  47.             this.freeze();
  48.          }
  49.  
  50.          return this.goTo(var1);
  51.       }
  52.    }
  53.  
  54.    boolean goTo(int var1) throws SQLException {
  55.       boolean var2 = false;
  56.       this.ignoreNotification(true);
  57.       var2 = this.relView.goTo(var1);
  58.       this.ignoreNotification(false);
  59.       return var2;
  60.    }
  61.  
  62.    int get() throws SQLException {
  63.       return this.frozen ? this.frozenRecordNumber : this.relView.getCurrentRecordNumber();
  64.    }
  65.  
  66.    void setNotificationMode(boolean var1) throws SQLException {
  67.       if (var1) {
  68.          ++this.notificationMode;
  69.       } else {
  70.          --this.notificationMode;
  71.          if (this.notificationMode == 0 && this.frozen) {
  72.             this.thaw();
  73.          }
  74.  
  75.       }
  76.    }
  77.  
  78.    boolean getNotificationMode() {
  79.       return this.notificationMode > 0;
  80.    }
  81.  
  82.    void ignoreNotification(boolean var1) {
  83.       if (var1) {
  84.          ++this.ignoreCount;
  85.       } else {
  86.          --this.ignoreCount;
  87.       }
  88.    }
  89.  
  90.    int getIgnoreCount() {
  91.       return this.ignoreCount;
  92.    }
  93. }
  94.